package com.corpgovernment.common.enums;

import java.util.Arrays;
import java.util.Objects;

public enum OrderSourceEnum {

	APP("APP"),
	Web("Web"),
	Agent("后台预订"),
	Supplier("供应商同步"),
	Supplement("手工补录");

	private String name;

	public static String getSourceName(String source) {
		return Arrays.stream(OrderSourceEnum.values()).filter(e -> Objects.equals(e.name, source)).map(OrderSourceEnum::getName).findFirst().orElse(APP.name);
	}

	public static String getSourceCode(String source) {
		return Arrays.stream(OrderSourceEnum.values()).filter(e -> Objects.equals(e.name(), source)).map(OrderSourceEnum::getName).findFirst().orElse(APP.name);
	}
	public String getName() {
		return name;
	}

	OrderSourceEnum(String name) {
		this.name = name;
	}
}
